// @Description 实现中间件
// @Author insight21
// @Since 2021/9/13

package web

import (
	"log"
	"time"
)

// 自带日志中间件
func Logger() HandlerFunc {
	return func(c *Context) {
		now := time.Now()
		c.Next()
		log.Printf("[%d] %s in %v", c.StatusCode, c.Request.RequestURI, time.Since(now))
	}
}
